#ifndef __NETIF_H__
#define __NETIF_H__
#include "ip.h"
#include "pbuf.h"
#include "ip_addr.h"
#include "tcp.h"
#include "udp.h"
struct netif;

#define NETIF_MAX_HWADDR_LEN 6U
#define IP_MAX_PROTOCOL      4U

extern struct netif *netif_list;

typedef uint8_t (*netif_init_fn)(struct netif *netif);

typedef uint8_t (*netif_input_fn)(struct pbuf *p, struct netif *inp);

typedef uint8_t (*netif_output_fn)(struct netif *netif, struct pbuf *p);


struct netif{
	struct netif *next;
        uint8_t hwaddr[NETIF_MAX_HWADDR_LEN];
        uint8_t deshwaddr[NETIF_MAX_HWADDR_LEN];
	ip_addr_t lacotip_addr;
        ip_addr_t remotip_addr;
	ip_addr_t netmask;
	ip_addr_t gw;
	struct udp_pcb *upcb;
	struct tcp_pcb *tpcb;
	netif_input_fn input;
	netif_output_fn output;
        uint8_t num;
        uint16_t flags;
        uint8_t  iphdrlen;
        uint16_t tcp_datalen;
        uint16_t ip_datalen;
};

//��������
uint8_t 
netif_add(struct netif *netif,ip_addr_t *ipaddr,netif_init_fn init,
            netif_output_fn output,struct udp_pcb *upcb,struct tcp_pcb *tpcb);

#endif 

